﻿@using MrCMS.Web.Areas.Admin.Models
@model System.Collections.Generic.List<MrCMS.Web.Areas.Admin.Models.PageDefaultsInfo>

<h1 class="page-header">@Resource("Admin Page Defaults Title", "Page Defaults")</h1>

<table class="table table-condensed table-striped">
    <thead>
        <tr>
            <th>
                @Resource("Admin Page Defaults Page Type", "Page Type")
            </th>
            <th>
                @Resource("Admin Page Defaults Default Generator", "Default Generator")
            </th>
            <th>
                @Resource("Admin Page Defaults Default Layout", "Default Layout")
            </th>
            <th>
                @Resource("Admin Page Defaults Cache Enabled", "Cached?")
            </th>
            <th>
                @Resource("Actions")
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var info in Model)
        {
            <tr>
                <td>
                    @info.DisplayName
                </td>
                <td>
                    @info.GeneratorDisplayName
                </td>
                <td>
                    @info.LayoutName
                </td>
                <td>
                    @if (info.CacheEnabled == CacheEnabledStatus.Enabled)
                    {
                        using (Html.BeginForm("DisableCache", "PageDefaults", new { info.TypeName }, FormMethod.Post))
                        {
                            @info.CacheEnabled
                            <button class="btn btn-warning btn-xs pull-right" type="submit">Disable cache</button>
                        }
                    }
                    else if (info.CacheEnabled == CacheEnabledStatus.Disabled)
                    {
                        using (Html.BeginForm("EnableCache", "PageDefaults", new { info.TypeName }, FormMethod.Post))
                        {
                            @info.CacheEnabled
                            <button class="btn btn-success btn-xs pull-right" type="submit">Enable cache</button>
                        }
                    }
                    else
                    {
                        @info.CacheEnabled
                    }
                </td>
                <td>
                    @Html.ActionLink(Resource("Admin Page Defaults Set Default", "Set default"), "Set", "PageDefaults", new { type = info.TypeName }, new { @class = "btn btn-xs btn-default", data_toggle = "fb-modal" })
                </td>
            </tr>
        }
</table>